package com.mark.web.stars.entity.vo;

import com.mark.common.utils.DateTimeUtil;
import com.mark.web.stars.entity.po.Memo;
import com.mark.web.stars.enums.MemoEnum;
import lombok.Data;

/**
 * @Description: 备忘录的vo实例属性
 * @Author: Mark
 * @CreateDate: 2019/3/30 13:02
 * @Version: 2.0
 * @Copyright : 豆浆油条个人非正式工作室
 */
@Data
public class MemoVo {

    /**
     * 主键id
     */
    private Integer id;

    /**
     * 逻辑外键用户id
     */
    private Integer fkUserId;

    /**
     * 逻辑外键 所属种类id
     */
    private Integer fkCategoryId;

    /**
     * 名称
     */
    private String name;

    /**
     * 描述
     */
    private String description;

    /**
     * 状态
     */
    private String status;

    /**
     * 排序
     */
    private Short priority;

    /**
     * 创建时间
     */
    private String createTime;

    /**
     * 期望完成时间
     */
    private String expectTime;

    /**
     * 期望完成时间的时间戳，回填时间需要
     */
    private Long expectTimeLong;

    /**
     * 实际完成时间
     */
    private String finishTime;

    /**
     * 通过构造函数实例化 vo 对象
     * @param memo ：memo实例
     */
    public MemoVo(Memo memo){
        this.id = memo.getId();
        this.fkUserId = memo.getFkUserId();
        this.fkCategoryId = memo.getFkCategoryId();
        this.name = memo.getName();
        this.description = memo.getDescription();
        this.status = MemoEnum.stateOf(memo.getEnableStatus());
        this.priority = memo.getPriority();
        this.createTime = DateTimeUtil.dateToStr2(memo.getCreateTime());
        this.expectTime = DateTimeUtil.dateToStr2(memo.getExpectTime());
        this.finishTime = DateTimeUtil.dateToStr2(memo.getFinishTime());
        this.expectTimeLong = memo.getExpectTime().getTime();
    }
}
